package com.witsight.hibernate.model;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.witsight.platform.bean.UserDetail;

/**   
 * 说明：数据库实体继承此抽象对象 (带有更新人和创建人)
 * @Title: BaseUserEntity.java 
 * @Package com.witsight.hibernate.model 
 * @See: {@link BaseEntity}
 * Copyright: Copyright (c) 2017
 * Company:sany huax witsight team by product
 * @author: fuyp  
 * @date: 2017年9月19日 下午2:53:09 
 * @version: V1.0
 *
 */
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseUserEntity extends BaseEntity {
	private static final long serialVersionUID = 119319307566965600L;
	@CreatedBy
    private UserDetail createUser; //创建用户
	
	@LastModifiedBy
    private UserDetail modifiedUser;// 修改用户
	@Column(name = "CREATE_USER")
	public UserDetail getCreateUser() {
		return createUser;
	}

	public void setCreateUser(UserDetail createUser) {
		this.createUser = createUser;
	}
	@Column(name = "MODIFIED_USER")
	public UserDetail getModifiedUser() {
		return modifiedUser;
	}

	public void setModifiedUser(UserDetail modifiedUser) {
		this.modifiedUser = modifiedUser;
	}
	
	@Override
	protected ToStringBuilder toStringBuilder() {
		return super.toStringBuilder()
				.append("createUser",createUser)
				.append("modifiedUser",modifiedUser);
	}
}
